<template>
    <div>
        <el-form ref="ruleForm" :model="ruleForm" rules="rules" label-width="100px" >
            <el-col :span="12">
                <el-form-item label="结算记录编号" prop="mainId">
                    <el-input :disabled="true" style="width: 260px" v-model="ruleForm.payoffId" readOnly="true"></el-input>
                </el-form-item>
            </el-col>

            <el-form-item label="人工费" prop="personPay">
                <el-input type="double" style="width: 260px" v-model="ruleForm.personPay" readOnly="true"></el-input>
            </el-form-item>

            <el-form-item label="材料费" prop="matiPay">
                <el-input type="double" style="width: 260px" v-model="ruleForm.matiPay" readOnly="true"></el-input>
            </el-form-item>


            <el-form-item label="成本费">
                <el-input
                        v-model="ruleForm.partPay"
                        type="datetime"
                        readOnly="true" style="width: 260px">
                </el-input>
            </el-form-item>

            <el-form-item label="注意事项">
                <el-input type="textarea" style="width: 260px" v-model="ruleForm.note" readOnly="true"></el-input>
            </el-form-item>
            <el-form-item label="保修承诺">
                <el-input type="textarea"  style="width: 260px" v-model="ruleForm.mainPermit" readOnly="true"></el-input>
            </el-form-item>
            <el-form-item label="估价">
                <el-input type="textarea"  style="width: 260px" v-model="ruleForm.estimate" readOnly="true"></el-input>
            </el-form-item>
            <el-form-item label="开始时间">
                <el-input type="textarea" style="width: 260px" v-model="ruleForm.startTime" readOnly="true"></el-input>
            </el-form-item>
            <el-form-item label="客户姓名">
                <el-input type="textarea" style="width: 260px" v-model="ruleForm.cName" readOnly="true"></el-input>
            </el-form-item>
            <el-form-item label="total">
                <el-input type="textarea" style="width: 260px" v-model="ruleForm.total" readOnly="true"></el-input>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
    import {getPayoffInfo as getPayoffInfo, } from '../../api/supervision'

    export default {
        props:["serviceId"],
        data () {
            return {
                ruleForm:{
                    payoffId:"",
                    personPay:"",
                    matiPay:"",
                    partPay:"",
                    serviceId:"",
                    note:"",
                    mainPermit:"",
                    estimate:"",
                    startTime:"",
                    cName:"",
                    total:"",
                },
            }
        },
        created(){
            if(this.serviceId){
                let param = new URLSearchParams();
                param.append('serviceId', this.serviceId);
                this.getPayoffInfo(param);
            }
        },
        components: {},
        methods: {
            getPayoffInfo(params) {
                let that = this;
                // 执行方法
                getPayoffInfo(params).then(r=>{
                    console.log("进入");
                    console.log(r);
                    this.ruleForm.payoffId = r.payoffId
                    this.ruleForm.personPay=r.personPay;
                    this.ruleForm.matiPay = r.matiPay;
                    this.ruleForm.partPay = r.partPay;
                    this.ruleForm.note = r.note;
                    this.ruleForm.mainPermit = r.mainPermit;
                    this.ruleForm.estimate = r.estimate;
                    this.ruleForm.startTime = new Date(r.startTime);
                    this.ruleForm.cName = r.cName;
                    this.ruleForm.total = r.total;

                }).catch(_=>{
                    console.log("获取客户信息失败！");
                })
            }
        }
    }
</script>

<style scoped>


</style>
